package ua.dogar.vectors;

import java.util.Iterator;

import ua.dogar.exceptions.IncompatibleVectorSizesException;
import ua.dogar.patterns.Observer;



public class MySynchronizedVector implements Vector {
	private Vector vec;

	public MySynchronizedVector(Vector vec) {
		this.vec = vec;
	}

	@Override
	 public Iterator<Double> iterator() {
		return vec.iterator();
	}

	@Override
	synchronized public void registerObserver(Observer o) {
		vec.registerObserver(o);
	}

	@Override
	synchronized public void removeObserver(Observer o) {
		vec.removeObserver(o);
	}

	@Override
	synchronized public void notifyObservers(int index) {
		vec.notifyObservers(index);
	}

	@Override
	synchronized public void notifyObservers() {
		vec.notifyObservers();
	}

	@Override
	synchronized public double getElement(int index) {
		return vec.getElement(index);
	}

	@Override
	synchronized public void setElement(double value, int index) {
		vec.setElement(value, index);
	}

	@Override
	synchronized public int getLength() {
		return vec.getLength();
	}

	@Override
	synchronized public void setElementsFromArray(double[] arr)
			throws IncompatibleVectorSizesException {
		vec.setElementsFromArray(arr);
	}

	@Override
	synchronized public void setElementsFromVector(Vector listVec)
			throws IncompatibleVectorSizesException {
		listVec.setElementsFromVector(listVec);
	}

	@Override
	synchronized public Vector mulVector(int num) {
		return vec.mulVector(num);
	}

	@Override
	synchronized public void addVector(Vector v) throws IncompatibleVectorSizesException {
		vec.addVector(v);
	}

	@Override
	synchronized public boolean compare(Vector listVec) {
		return listVec.compare(listVec);
	}

}
